#!/bin/sh
#
# Prepare PostgreSQL DBMS for labman2 by deliting existing db and user
# and making new ones
# Use install.sh for making a fresh install.
# You need to change DIR in install.sh to labman2 base directory.

cmddir=`dirname $0`
dumpfile=labman2_`date "+%Y%m%d"`.dump

echo "sudo -u www pg_dump labman2 > $dumpfile"
sudo -u www pg_dump labman2 > $dumpfile

sudo -u pgsql dropdb labman2
sudo -u pgsql dropuser www

$cmddir/install.sh $@